<?php
    $this->load->view('wx/public/header.html', [
        'time' => time(),
       'css' => [
            'assets/wx/css/order.css',
        ]
    ]);
?>

<body class="order" ng-controller="wx-order-confirm-controller">

<!--地址-->
<div class="aui-content aui-margin-b-10 gu-address-top">
    <ul class="aui-list aui-media-list" ng-show="!showAddAddress">
        <li class="aui-list-item aui-list-item-arrow gu-item-bg" ng-click="selectAddr()">
            <div class="aui-media-list-item-inner aui-margin-l-15">
                <div class="aui-list-item-inner">
                    <i class="aui-iconfont aui-icon-location gu-location-icon"></i>
                    <div class="aui-list-item-text">
                        <div class="aui-list-item-title aui-font-size-14" ng-bind="address.name"></div>
                        <div class="aui-list-item-right aui-font-size-12" ng-bind="address.phone"></div>
                    </div>
                    <div class="aui-list-item-text aui-ellipsis-1 aui-font-size-12" ng-bind="address.detail"></div>
                </div>
            </div>
        </li>
    </ul>
    <div class="aui-padded-l-15 aui-padded-r-15 aui-padded-t-10 aui-padded-b-10" style="background: #FFFFFF;" ng-show="showAddAddress">
        <a href="/address/add?s=confirm" class="aui-btn aui-btn-danger aui-btn-block aui-btn-outlined aui-btn-sm">添加地址</a>
    </div>
</div>

<!--商品-->
<section class="aui-content">
    <div class="aui-card-list gu-order-card-list-item">
        <div class="aui-card-list-header gu-order-sn aui-padded-l-10 aui-padded-r-10">
            <span class="aui-pull-left aui-font-size-14">订单详情</span>
        </div>
        <div class="aui-card-list-content">
            <ul class="aui-list aui-media-list">
                <li class="aui-list-item gu-lists" ng-repeat="g in goods">
                    <div class="aui-media-list-item-inner">
                        <div class="aui-list-item-media gu-confirm-thumb">
                            <img ng-src="{{ g.thumb }}">
                        </div>

                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-text aui-margin-b-15">
                                <div class="aui-list-item-title aui-ellipsis-2 gu-order-goods-name aui-font-size-12" ng-bind="g.goodsName"></div>
                                <div class="aui-list-item-right gu-order-price aui-font-size-16" ng-bind="'￥ ' + g.price_format"></div>
                            </div>
                            <div class="aui-info aui-margin-t-10 aui-margin-l-0 aui-margin-r-0 gu-info-item" style="padding:0">
                                <div class="aui-info-item" ng-bind="'规格: ' + g.ruleName"></div>
                                <div class="aui-info-item" ng-bind="'数量: ' + g.num"></div>
                            </div>
                        </div>
                    </div>
                </li>
                <li class="aui-list-item">
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-title aui-font-size-14 gu-express-left">配送方式</div>
                        <div class="aui-list-item-right gu-express-right">物流/快递</div>
                    </div>
                </li>
            </ul>
        </div>
    </div>

</section>

<!--留言-->
<div class="aui-content aui-margin-b-10">
    <ul class="aui-list aui-form-list">
        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-input">
                     <textarea class="aui-font-size-14 gu-order-message" placeholder="选填：给商家留言（90字以内）" ng-model="message"></textarea>
                </div>
            </div>
        </li>
    </ul>
</div>

<!--优惠券-->
<div class="aui-content aui-margin-b-15">
    <ul class="aui-list aui-list-in">
        <li class="aui-list-item aui-list-item-middle" ng-click="tickets.length > 0 && alertPop()">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">优惠券 <div class="aui-label aui-label-danger" ng-hide="tickets.length == 0" ng-bind="'共' + tickets.length + '张'"></div></div>
                <div class="aui-list-item-right">
                    <span ng-bind="!selectedTicket.id ? '未使用' : '使用 ' + selectedTicket.name"></span>
                </div>
            </div>
        </li>
        <li class="aui-list-item aui-list-item-middle" ng-click="userInfo.amountUnLimit > 0 && alertCash()">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">余额 <div class="aui-label aui-label-danger" ng-hide="userInfo.amountUnLimit == 0" ng-bind="userInfo.amountUnLimit.format + '元可用'"></div></div>
                <div class="aui-list-item-right">
                    <span ng-hide="userInfo.amountUnLimit > 0">无可消费余额</span>
                    <span ng-hide="userInfo.amountUnLimit == 0" ng-bind="usemoney.isUse ? '使用 余额 ￥' + usemoney.amountUnLimit_format : '未使用'"></span>
                </div>
            </div>
        </li>
        <li class="aui-list-item aui-list-item-middle" ng-click="tickets.length > 0 && alertPop()">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">积分</div>
                <div class="aui-list-item-right">
                </div>
            </div>
        </li>
    </ul>
</div>

<!--价格-->
<div class="aui-content aui-margin-b-10">
    <ul class="aui-list aui-list-in">
        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title aui-font-size-14 gu-price-title">商品价格</div>
                <div class="aui-list-item-right aui-font-size-14 gu-price-desc" ng-bind="'￥ ' + totalFormat"></div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title aui-font-size-14">
                    物流费用
                </div>
                <div class="aui-list-item-right aui-font-size-14 gu-price-desc" ng-bind="'￥ ' + expressTotalFormat"></div>
            </div>
        </li>
        <li class="aui-list-item" ng-show="selectedTicket.id">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title aui-font-size-14">
                    优惠券
                </div>
                <div class="aui-list-item-right aui-font-size-14 gu-price-desc" ng-bind="'- ￥ ' + selectedTicket.amount_cny"></div>
            </div>
        </li>
        <li class="aui-list-item" ng-show="usemoney.isUse">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title aui-font-size-14">
                    余额支付
                </div>
                <div class="aui-list-item-right aui-font-size-14 gu-price-desc" ng-bind="'- ￥ ' + usemoney.amount_format"></div>
            </div>
        </li>
    </ul>
</div>

<footer class="aui-bar aui-bar-tab gu-comfirm-footer" id="footer">
    <div class="aui-bar-tab-item aui-active gu-comfirm-footer-left">
        <div class="aui-bar-tab-label aui-font-size-14 aui-text-right aui-padded-r-5">实付款:<span ng-bind="'￥' + totalPriceFormat"></span></div>
    </div>
    <div class="aui-bar-tab-item gu-comfirm-footer-right" ng-class="{'active': isSubmitting}">
        <div class="aui-bar-tab-label aui-font-size-16" ng-click="add()">提交订单</div>
    </div>
</footer>

<!--弹出层-->
<div class="aui-popup aui-popup-bottom gu-c-alert" id="bottom">
    <div class="aui-popup-content gu-c-alert-pannel">
        <div class="aui-row aui-row-padded gu-c-alert-box">
            <div class="aui-tab gu-tab" id="tab">
                <div class="aui-tab-item" ng-click="setNowType('canuse')" ng-class="{'aui-active': nowType == 'canuse'}" ng-bind="'可使用('+ canuse +')'"></div>
                <div class="aui-tab-item" ng-click="setNowType('canotuse')" ng-class="{'aui-active': nowType == 'canotuse'}" ng-bind="'不能使用('+ canotuse +')'"></div>
            </div>

            <ul class="gu-ticket aui-list aui-media-list aui-padded-l-10 aui-padded-r-10 aui-padded-t-10 aui-padded-b-10">
                <li ng-repeat="(index, l) in tickets" ng-if="(l.canuse && nowType == 'canuse') || (!l.canuse && nowType == 'canotuse')" class="aui-list-item aui-margin-b-10 gu-ticket-item">
                    <div class="aui-media-list-item-inner">
                        <div class="gu-ticket-icon" ng-hide="nowType == 'canotuse'" ng-click="selectTicket(l)"><label><input class="aui-radio gu-t-radio" ng-class="{'active': l.selected}" type="radio" name="demo1"></label></div>
                        <div class="aui-list-item-media">
                            <p class="gu-price"><strong ng-bind="l.amount_format + '元'"></strong></p>
                            <p class="gu-desc" ng-bind="'满' + l.limit_amount_format + '元可用'"></p>
                        </div>
                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-text">
                                <div class="aui-list-item-title" ng-bind="l.name"></div>
                            </div>
                            <div class="aui-list-item-text" style="position: absolute; bottom: 0;">
                                <div class="aui-info-item" ng-bind="l.time_start + ' 至 ' + l.time_end "></div>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>

            <a href="/center/ticket" class="go-ticket-center">更多好券,去领券中心看看 <span class="aui-iconfont aui-icon-forward"></span></a>
            <a href="javascript:void(0);" ng-click="confirmTicket()" class="go-confirm-btn">确定</a>
        </div>
    </div>
</div>

<!--余额支付-->
<div class="aui-popup aui-popup-bottom gu-c-alert" id="lessAmount">
    <div class="aui-popup-content gu-c-alert-pannel">
        <div class="aui-row aui-row-padded gu-c-alert-box">
            <div class="aui-tips aui-margin-b-15 aui-bg-danger" ng-show="usemoney.showError" id="tips-1">
                <i class="aui-iconfont aui-icon-info"></i>
                <div class="aui-tips-title" ng-bind="usemoney.msg"></div>
                <i class="aui-iconfont aui-icon-close"></i>
            </div>

            <div class="aui-card-list aui-margin-b-15">
                <div class="aui-card-list-header" style="color: #757575;">
                    余额支付
                </div>
                <div class="aui-card-list-content-padded gu-cashout-money">
                    <input type="number" placeholder="0.00" ng-model="usemoney.amount_text" style="font-size: 30px; color: #000;">
                </div>
                <div class="aui-card-list-footer aui-border-t" ng-bind="'可用余额 '+userInfo.amountUnLimit_format + ' 元'">
                </div>
            </div>

            <div class="aui-padded-l-15 aui-padded-r-15 aui-margin-t-15">
                <div class="aui-btn aui-btn-block gu-btn-bg gu-text-default"
                     ng-click="useAmount()" style="color: #ffffff;">立即使用</div>
            </div>
        </div>
    </div>
</div>

<?php
    $this->load->view('wx/public/footer.html', [
        'time' => time(),
        'js' => [
            'assets/library/aui/script/aui-popup.js',
            'assets/wx/js/order/confirm.js'
        ]
    ]);
?>
